// import { send } from '@/serves/index'
import eventSource from '@/serves/eventSource'
// import { webApi } from '@/serves/api.config'
import { pengWeiApp } from '@/serves/prefixConfig'

export function chatAiDocStart({
	onMessage,
	onEnd,
}: {
	onMessage: (msg: any, evtSource: any) => void
	onEnd: () => void
}) {
	eventSource({
		url: `${pengWeiApp.pengWeiWebApi}/service-dome/doc/start`,
		onMessage,
		onEnd,
	})
}

// 获取sse数据流
export function getFileSSE({
	fileName,
	onMessage,
	onEnd,
}: {
	fileName: string
	onMessage: (msg: any, evtSource: any) => void
	onEnd: () => void
}) {
	eventSource({
		url: `${pengWeiApp.pengWeiWebApi}/service-dome/doc/getFileSSE?fileName=${fileName}`,
		onMessage,
		onEnd,
	})
}
